using UnityEngine;

public class LoopDetector : MonoBehaviour
{
	public LoopTrigger[] triggers;

	public float unCheckTime = 10f;

	public int loopCount;

	public void CheckLoop()
	{
		LoopTrigger[] array = triggers;
		foreach (LoopTrigger loopTrigger in array)
		{
			if (!loopTrigger.check)
			{
				return;
			}
		}
		LoopDetected();
	}

	private void LoopDetected()
	{
		LoopTrigger[] array = triggers;
		foreach (LoopTrigger loopTrigger in array)
		{
			loopTrigger.check = false;
		}
		GameplayEventsManager.instance.NewDrivingEvent(0f, null, true);
		loopCount++;
		if (loopCount == 3)
		{
		}
		CancelInvoke("ResetLoopsCount");
		Invoke("ResetLoopsCount", 10f);
	}

	private void ResetLoopsCount()
	{
		loopCount = 0;
	}
}
